
/*
 * @Descripttion:资产信息管理接口API
 * @Author:
 * @version:
 */



import { requestUrl } from '../util/request'
import { workflowList } from './comAPI'


// 分页查询资产列表
export function assetList(params: any = {}) {
	return requestUrl({
		url: `/asset/list`,
		data: params,
		method: 'get',
		keyWord: 'assets',
		isJson: false
	})
}
// 分页查询确认签收列表
export function cfrList(params: any = {}) {
	return requestUrl({
		url: `/assetExecDtl`,
		data: params,
		method: 'get',
		keyWord: 'assets',
		isJson: false
	})
}
// 资产申请分页查询列表
export function applyList(params: any = {}) {
	return requestUrl({
		url: `/assetApply`,
		data: params,
		method: 'get',
		keyWord: 'assets',
		isJson: false
	})
}
// 资产退回分页查询
export function retrueData(params: any = {}) {
	return requestUrl({
		url: `/assetExecDtl//exclusion-repair-list`,
		data: params,
		method: 'get',
		keyWord: 'assets',
		isJson: false
	})
}
// 删除资产申请
export function delApply(assetApplyId: any) {
	return requestUrl({
		url: `/assetApply/${assetApplyId}`,
		data: '',
		method: 'delete',
		keyWord: 'assets',
		isJson: true
	})
}
// 资产详情查询
export function assetDetail(id: any) {
	return requestUrl({
		url: `/asset?assetNo=${id}`,
		data: '',
		method: 'get',
		keyWord: 'assets',
		isJson: false
	})
}
// 资产申请详情查询
export function applyDetail(id: any) {
	return requestUrl({
		url: `/assetApply/${id}`,
		data: '',
		method: 'get',
		keyWord: 'assets',
		isJson: false
	})
}
// 资产申请详情明细列表
export function applyDetailList(pram: any) {
	return requestUrl({
		url: `/assetApply/dtl`,
		data: pram,
		method: 'get',
		keyWord: 'assets',
		isJson: false
	})
}
// 退回资产详情查询
export function retrueDetail(id: any) {
	return requestUrl({
		url: `/assetApply/${id}`,
		data: '',
		method: 'get',
		keyWord: 'assets',
		isJson: false
	})
}
// 确认签收
export function assetSign(params: []) {
	return requestUrl({
		url: `/assetExecDtl/confirmation`,
		data: params,
		method: 'put',
		keyWord: 'assets',
		isJson: true
	})
}
// 获取退回详情items
export function getRetrueItems(assetApplyId: any) {
	return requestUrl({
		url: `/assetExecDtl/apply/${assetApplyId}`,
		data: '',
		method: 'get',
		keyWord: 'assets',
		isJson: false
	})
}
// 扫码签收
export function qrSign(params: []) {
	return requestUrl({
		url: `/assetExecDtl/receive`,
		data: { assetNoList: params },
		method: 'put',
		keyWord: 'assets',
		isJson: true
	})
}
// 提交申请
export async function submitApply(params: {}) {
	return requestUrl({
		url: `/assetApply?assetApplyType=1`,
		data: params,
		method: 'post',
		keyWord: 'assets',
		isJson: true
	})
}
//提交审核
export async function applyExamine(params: {}) {
	const subCode = await workflowList()
	return requestUrl({
		url: `/assetApply/submit`,
		data: {
			applySubCode: subCode.data[0].subCode,
			businessDatas: params
		},
		method: 'put',
		keyWord: 'assets',
		isJson: true
	})
}

//作废
export function applyAbandon(params: {}) {
	return requestUrl({
		url: `/assetApply/cancel`,
		data: params,
		method: 'put',
		keyWord: 'assets',
		isJson: true
	})
}

//编辑提交申请
export function editApply(params: {}) {
	return requestUrl({
		url: `/assetApply`,
		data: params,
		method: 'put',
		keyWord: 'assets',
		isJson: true
	})
}

// 实施
export function exec(params: {}) {
	return requestUrl({
		url: `/assetExecDtl/exec`,
		data: params,
		method: 'put',
		keyWord: 'assets',
		isJson: true
	})
}
// 调拨出库
export function execOut(params: {}) {
	return requestUrl({
		url: `/assetExecDtl/execOut`,
		data: params,
		method: 'put',
		keyWord: 'assets',
		isJson: true
	})
}
// 资产(报废、退回、报修)申请 新增
export function assetHand(params: {}) {
	return requestUrl({
		url: `/assetApply/apply`,
		data: params,
		method: 'post',
		keyWord: 'assets',
		isJson: true
	})
}

//获取资产类型
export function assetType() {
	return requestUrl({
		url: `/sysenum/by-type/AssetType`,
		data: '',
		method: 'get',
		keyWord: 'assets',
		isJson: true
	})
}

//通过资产id查询相关实施
export function assetApplyInfo(assetId, prams) {
	return requestUrl({
		url: `/assetExecDtl/by-asset-id/${assetId}`,
		data: prams,
		method: 'get',
		keyWord: 'assets',
		isJson: true
	})
}
//验收资产
export function assetAccept(prams) {
	return requestUrl({
		url: `/assetExecDtl/submit-review`,
		data: prams,
		method: 'put',
		keyWord: 'assets',
		isJson: true
	})
}
// 闲置资产
export function unusedAsset(params) {
	return requestUrl({
		url: `/asset/idle`,
		data: params,
		method: 'put',
		keyWord: 'assets',
		isJson: true
	})
}
// 获取资产申请编号
export function getNumber_api(params) {
	return requestUrl({
		url: `/num`,
		data: params,
		method: 'get',
		keyWord: 'assets',
		isJson: true
	})
}